<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>php常用技巧 | To Share</title>
    <meta name="generator" content="VuePress 1.9.7">
    <link rel="icon" href="/share/favicon.ico">
    <meta name="description" content="分享风雨，享受阳光">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    
    <link rel="preload" href="/share/assets/css/0.styles.d7affcea.css" as="style"><link rel="preload" href="/share/assets/js/app.706684de.js" as="script"><link rel="preload" href="/share/assets/js/3.4685d505.js" as="script"><link rel="preload" href="/share/assets/js/1.b12738fb.js" as="script"><link rel="preload" href="/share/assets/js/59.5239e9d4.js" as="script"><link rel="preload" href="/share/assets/js/9.4e81f08e.js" as="script"><link rel="prefetch" href="/share/assets/js/10.9e95ce7b.js"><link rel="prefetch" href="/share/assets/js/11.e99410dc.js"><link rel="prefetch" href="/share/assets/js/12.e9afe07c.js"><link rel="prefetch" href="/share/assets/js/13.078dd281.js"><link rel="prefetch" href="/share/assets/js/14.6575b8f0.js"><link rel="prefetch" href="/share/assets/js/15.d942bb10.js"><link rel="prefetch" href="/share/assets/js/16.fd8cc40c.js"><link rel="prefetch" href="/share/assets/js/17.f1b1f2c6.js"><link rel="prefetch" href="/share/assets/js/18.b312ce79.js"><link rel="prefetch" href="/share/assets/js/19.a99d170f.js"><link rel="prefetch" href="/share/assets/js/20.cda2b911.js"><link rel="prefetch" href="/share/assets/js/21.d6062607.js"><link rel="prefetch" href="/share/assets/js/22.5a50eee4.js"><link rel="prefetch" href="/share/assets/js/23.be601eed.js"><link rel="prefetch" href="/share/assets/js/24.3d0b9811.js"><link rel="prefetch" href="/share/assets/js/25.c1c35d96.js"><link rel="prefetch" href="/share/assets/js/26.9a8b03ff.js"><link rel="prefetch" href="/share/assets/js/27.6c302f3e.js"><link rel="prefetch" href="/share/assets/js/28.5eb55960.js"><link rel="prefetch" href="/share/assets/js/29.8297842b.js"><link rel="prefetch" href="/share/assets/js/30.b453256b.js"><link rel="prefetch" href="/share/assets/js/31.6ce2e46f.js"><link rel="prefetch" href="/share/assets/js/32.cf3906ab.js"><link rel="prefetch" href="/share/assets/js/33.83680f76.js"><link rel="prefetch" href="/share/assets/js/34.dada508c.js"><link rel="prefetch" href="/share/assets/js/35.11a36f17.js"><link rel="prefetch" href="/share/assets/js/36.fc43ef74.js"><link rel="prefetch" href="/share/assets/js/37.af715eba.js"><link rel="prefetch" href="/share/assets/js/38.7ba3e6e1.js"><link rel="prefetch" href="/share/assets/js/39.cd1c9d09.js"><link rel="prefetch" href="/share/assets/js/4.c1f99423.js"><link rel="prefetch" href="/share/assets/js/40.8df0c044.js"><link rel="prefetch" href="/share/assets/js/41.e643a418.js"><link rel="prefetch" href="/share/assets/js/42.d809cd4f.js"><link rel="prefetch" href="/share/assets/js/43.5136999f.js"><link rel="prefetch" href="/share/assets/js/44.315a82bf.js"><link rel="prefetch" href="/share/assets/js/45.a4b04306.js"><link rel="prefetch" href="/share/assets/js/46.2e8ec77e.js"><link rel="prefetch" href="/share/assets/js/47.d6bde2ca.js"><link rel="prefetch" href="/share/assets/js/48.e8e85c15.js"><link rel="prefetch" href="/share/assets/js/49.fce2ff19.js"><link rel="prefetch" href="/share/assets/js/5.599dfd12.js"><link rel="prefetch" href="/share/assets/js/50.3918e713.js"><link rel="prefetch" href="/share/assets/js/51.c5ddf50e.js"><link rel="prefetch" href="/share/assets/js/52.b6653f73.js"><link rel="prefetch" href="/share/assets/js/53.c0420367.js"><link rel="prefetch" href="/share/assets/js/54.0f64522f.js"><link rel="prefetch" href="/share/assets/js/55.1f9ce6fb.js"><link rel="prefetch" href="/share/assets/js/56.0a2fc30f.js"><link rel="prefetch" href="/share/assets/js/57.3b81efcb.js"><link rel="prefetch" href="/share/assets/js/58.c617dcad.js"><link rel="prefetch" href="/share/assets/js/6.4e5676a9.js"><link rel="prefetch" href="/share/assets/js/60.b614d70b.js"><link rel="prefetch" href="/share/assets/js/61.f45be005.js"><link rel="prefetch" href="/share/assets/js/62.52121455.js"><link rel="prefetch" href="/share/assets/js/63.9f699597.js"><link rel="prefetch" href="/share/assets/js/64.01c4bf37.js"><link rel="prefetch" href="/share/assets/js/65.0f31fd4b.js"><link rel="prefetch" href="/share/assets/js/66.55dbbe80.js"><link rel="prefetch" href="/share/assets/js/67.fd9ba6df.js"><link rel="prefetch" href="/share/assets/js/68.c6c9e158.js"><link rel="prefetch" href="/share/assets/js/69.91757641.js"><link rel="prefetch" href="/share/assets/js/7.b8928c33.js"><link rel="prefetch" href="/share/assets/js/70.12f0a894.js"><link rel="prefetch" href="/share/assets/js/71.88c99794.js"><link rel="prefetch" href="/share/assets/js/72.e1d99c59.js"><link rel="prefetch" href="/share/assets/js/73.aee6f06a.js"><link rel="prefetch" href="/share/assets/js/74.b47532b0.js"><link rel="prefetch" href="/share/assets/js/75.1f1ab66e.js"><link rel="prefetch" href="/share/assets/js/8.56deb6eb.js">
    <link rel="stylesheet" href="/share/assets/css/0.styles.d7affcea.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container" data-v-130b300a><div data-v-130b300a><div class="password-shadow password-wrapper-out" style="display:none;" data-v-25ba6db2 data-v-130b300a data-v-130b300a><h3 class="title" data-v-25ba6db2 data-v-25ba6db2>To Share</h3> <p class="description" data-v-25ba6db2 data-v-25ba6db2>分享风雨，享受阳光</p> <label id="box" class="inputBox" data-v-25ba6db2 data-v-25ba6db2><input type="password" value="" data-v-25ba6db2> <span data-v-25ba6db2>Konck! Knock!</span> <button data-v-25ba6db2>OK</button></label> <div class="footer" data-v-25ba6db2 data-v-25ba6db2><span data-v-25ba6db2><i class="iconfont reco-theme" data-v-25ba6db2></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-25ba6db2>vuePress-theme-reco</a></span> <span data-v-25ba6db2><i class="iconfont reco-copyright" data-v-25ba6db2></i> <a data-v-25ba6db2><!---->
            
          <span data-v-25ba6db2>2018 - </span>
          2022
        </a></span></div></div> <div class="hide" data-v-130b300a><header class="navbar" data-v-130b300a><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/share/" class="home-link router-link-active"><!----> <span class="site-name">To Share</span></a> <div class="links"><div class="color-picker"><a class="color-button"><i class="iconfont reco-color"></i></a> <div class="color-picker-menu" style="display:none;"><div class="mode-options"><h4 class="title">Choose mode</h4> <ul class="color-mode-options"><li class="dark">dark</li><li class="auto active">auto</li><li class="light">light</li></ul></div></div></div> <div class="search-box"><i class="iconfont reco-search"></i> <input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/share/" class="nav-link"><i class="iconfont reco-home"></i>
  Home
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      Category
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/share/categories/docker/" class="nav-link"><i class="undefined"></i>
  docker
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/book/" class="nav-link"><i class="undefined"></i>
  book
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/flex/" class="nav-link"><i class="undefined"></i>
  flex
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/css/" class="nav-link"><i class="undefined"></i>
  css
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/git/" class="nav-link"><i class="undefined"></i>
  git
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/golang/" class="nav-link"><i class="undefined"></i>
  golang
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/gui/" class="nav-link"><i class="undefined"></i>
  gui
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/idea/" class="nav-link"><i class="undefined"></i>
  idea
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/js/" class="nav-link"><i class="undefined"></i>
  js
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/linux/" class="nav-link"><i class="undefined"></i>
  linux
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/mysql/" class="nav-link"><i class="undefined"></i>
  mysql
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/nodeJs/" class="nav-link"><i class="undefined"></i>
  nodeJs
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/php/" class="nav-link"><i class="undefined"></i>
  php
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/python/" class="nav-link"><i class="undefined"></i>
  python
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/site/" class="nav-link"><i class="undefined"></i>
  site
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/vue/" class="nav-link"><i class="undefined"></i>
  vue
</a></li></ul></div></div><div class="nav-item"><a href="/share/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  Tag
</a></div><div class="nav-item"><a href="/share/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  TimeLine
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      Docs
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/share/docs/git/" class="nav-link"><i class="undefined"></i>
  git
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/vue/" class="nav-link"><i class="undefined"></i>
  vue
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/flex/" class="nav-link"><i class="undefined"></i>
  css
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/js/" class="nav-link"><i class="undefined"></i>
  js
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/node/" class="nav-link"><i class="undefined"></i>
  nodeJs
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/docker/" class="nav-link"><i class="undefined"></i>
  docker
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/php/" aria-current="page" class="nav-link router-link-exact-active router-link-active"><i class="undefined"></i>
  php
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/linux/" class="nav-link"><i class="undefined"></i>
  linux
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/python/" class="nav-link"><i class="undefined"></i>
  python
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/gui/" class="nav-link"><i class="undefined"></i>
  GUI
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/golang/" class="nav-link"><i class="undefined"></i>
  golang
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/idea/" class="nav-link"><i class="undefined"></i>
  idea
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/site/" class="nav-link"><i class="undefined"></i>
  site
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/book/" class="nav-link"><i class="undefined"></i>
  book
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/mysql/" class="nav-link"><i class="undefined"></i>
  mysql
</a></li></ul></div></div><div class="nav-item"><a href="https://gitee.com/zenglingchuan" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-mayun"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-130b300a></div> <aside class="sidebar" data-v-130b300a><div class="personal-info-wrapper" data-v-39576ba9 data-v-130b300a><img src="/share/avatar.png" alt="author-avatar" class="personal-img" data-v-39576ba9> <!----> <div class="num" data-v-39576ba9><div data-v-39576ba9><h3 data-v-39576ba9>63</h3> <h6 data-v-39576ba9>文章</h6></div> <div data-v-39576ba9><h3 data-v-39576ba9>51</h3> <h6 data-v-39576ba9>标签</h6></div></div> <ul class="social-links" data-v-39576ba9></ul> <hr data-v-39576ba9></div> <nav class="nav-links"><div class="nav-item"><a href="/share/" class="nav-link"><i class="iconfont reco-home"></i>
  Home
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      Category
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/share/categories/docker/" class="nav-link"><i class="undefined"></i>
  docker
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/book/" class="nav-link"><i class="undefined"></i>
  book
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/flex/" class="nav-link"><i class="undefined"></i>
  flex
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/css/" class="nav-link"><i class="undefined"></i>
  css
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/git/" class="nav-link"><i class="undefined"></i>
  git
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/golang/" class="nav-link"><i class="undefined"></i>
  golang
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/gui/" class="nav-link"><i class="undefined"></i>
  gui
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/idea/" class="nav-link"><i class="undefined"></i>
  idea
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/js/" class="nav-link"><i class="undefined"></i>
  js
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/linux/" class="nav-link"><i class="undefined"></i>
  linux
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/mysql/" class="nav-link"><i class="undefined"></i>
  mysql
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/nodeJs/" class="nav-link"><i class="undefined"></i>
  nodeJs
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/php/" class="nav-link"><i class="undefined"></i>
  php
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/python/" class="nav-link"><i class="undefined"></i>
  python
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/site/" class="nav-link"><i class="undefined"></i>
  site
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/vue/" class="nav-link"><i class="undefined"></i>
  vue
</a></li></ul></div></div><div class="nav-item"><a href="/share/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  Tag
</a></div><div class="nav-item"><a href="/share/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  TimeLine
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      Docs
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/share/docs/git/" class="nav-link"><i class="undefined"></i>
  git
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/vue/" class="nav-link"><i class="undefined"></i>
  vue
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/flex/" class="nav-link"><i class="undefined"></i>
  css
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/js/" class="nav-link"><i class="undefined"></i>
  js
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/node/" class="nav-link"><i class="undefined"></i>
  nodeJs
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/docker/" class="nav-link"><i class="undefined"></i>
  docker
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/php/" aria-current="page" class="nav-link router-link-exact-active router-link-active"><i class="undefined"></i>
  php
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/linux/" class="nav-link"><i class="undefined"></i>
  linux
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/python/" class="nav-link"><i class="undefined"></i>
  python
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/gui/" class="nav-link"><i class="undefined"></i>
  GUI
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/golang/" class="nav-link"><i class="undefined"></i>
  golang
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/idea/" class="nav-link"><i class="undefined"></i>
  idea
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/site/" class="nav-link"><i class="undefined"></i>
  site
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/book/" class="nav-link"><i class="undefined"></i>
  book
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/mysql/" class="nav-link"><i class="undefined"></i>
  mysql
</a></li></ul></div></div><div class="nav-item"><a href="https://gitee.com/zenglingchuan" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-mayun"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <!----></nav> <ul class="sidebar-links"><li><a href="/share/docs/php/" aria-current="page" class="active sidebar-link">php常用技巧</a></li><li><a href="/share/docs/php/composer.html" class="sidebar-link">composer包制作</a></li><li><a href="/share/docs/php/laravel.html" class="sidebar-link">laravel项目配置</a></li><li><a href="/share/docs/php/laravelSkill.html" class="sidebar-link">laravel速查</a></li><li><a href="/share/docs/php/sign.html" class="sidebar-link">项目基本规则</a></li></ul> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-25ba6db2 data-v-130b300a><h3 class="title" data-v-25ba6db2 data-v-25ba6db2>php常用技巧</h3> <!----> <label id="box" class="inputBox" data-v-25ba6db2 data-v-25ba6db2><input type="password" value="" data-v-25ba6db2> <span data-v-25ba6db2>Konck! Knock!</span> <button data-v-25ba6db2>OK</button></label> <div class="footer" data-v-25ba6db2 data-v-25ba6db2><span data-v-25ba6db2><i class="iconfont reco-theme" data-v-25ba6db2></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-25ba6db2>vuePress-theme-reco</a></span> <span data-v-25ba6db2><i class="iconfont reco-copyright" data-v-25ba6db2></i> <a data-v-25ba6db2><!---->
            
          <span data-v-25ba6db2>2018 - </span>
          2022
        </a></span></div></div> <div data-v-130b300a><main class="page"><section><div class="page-title"><h1 class="title">php常用技巧</h1> <div data-v-f875f3fc><!----> <i class="iconfont reco-date" data-v-f875f3fc><span data-v-f875f3fc>2022/5/4</span></i> <!----> <i class="tags iconfont reco-tag" data-v-f875f3fc><span class="tag-item" data-v-f875f3fc>php</span><span class="tag-item" data-v-f875f3fc>file</span></i></div></div> <div class="theme-reco-content content__default"><div id="boxx" data-v-f4ca0dac><div data-v-f4ca0dac><p v-if="true" class="custom-block-title" data-v-f4ca0dac></p> <p v-if="true" data-v-f4ca0dac></p></div></div> <h2 id="windows-phpstudy-下php-8-0-12-安装mcrypt扩展问题"><a href="#windows-phpstudy-下php-8-0-12-安装mcrypt扩展问题" class="header-anchor">#</a> Windows(phpStudy)下php(8.0.12)安装mcrypt扩展问题</h2> <p><span style="color:blue;font-weight:bold;">问题:</span></p> <div class="language-text line-numbers-mode"><pre class="language-text"><code> Problem 1
    - Root composer.json requires PHP extension ext-mcrypt * but 
      it is missing from your system. 
      Install or enable PHP's mcrypt extension.
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p><span style="color:blue;font-weight:bold;">解决:</span></p> <ul><li><code>https://windows.php.net/downloads/pecl/releases/</code>去这个网址下载你所需要的扩展：这里我们下载mcrypt扩展</li></ul> <img src="/share/php/12.png" alt="foo"> <ul><li>放到php对应扩展目录里面</li></ul> <img src="/share/php/13.png" alt="foo"> <ul><li>在php.ini中启用扩展</li></ul> <img src="/share/php/14.png" alt="foo"> <ul><li>重启生效</li></ul> <h2 id="代码修改后延时生效问题"><a href="#代码修改后延时生效问题" class="header-anchor">#</a> 代码修改后延时生效问题</h2> <p><span style="color:blue;font-weight:bold;">原因:</span></p> <p>一般就是缓存原因,导致代码修改后不能及时生效</p> <p><span style="color:blue;font-weight:bold;">解决:</span></p> <ul><li>检查nginx配置文件是否设置缓存</li> <li>检查php.ini是否设置缓存
<ul><li>opcache.revalidate_freq=60 表示缓存过期时间为60秒</li> <li>修改为opcache.revalidate_freq=0 表示每次请求都要去检查</li></ul></li></ul> <h2 id="curl抓取"><a href="#curl抓取" class="header-anchor">#</a> CURL抓取</h2> <div class="language-php line-numbers-mode"><pre class="language-php"><code><span class="token comment">/**
 * 抓取curl
 * @param $url string 抓取的地址
 * @param $method string 请求方式
 * @param $params array 数组参数
 * @return array
 */</span>
  <span class="token keyword">private</span> <span class="token keyword">function</span> <span class="token function-definition function">curl</span><span class="token punctuation">(</span><span class="token keyword type-hint">string</span> <span class="token variable">$url</span><span class="token punctuation">,</span> <span class="token keyword type-hint">string</span> <span class="token variable">$method</span> <span class="token operator">=</span> <span class="token string single-quoted-string">'GET'</span><span class="token punctuation">,</span> <span class="token keyword type-hint">array</span> <span class="token variable">$params</span> <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword return-type">array</span>
  <span class="token punctuation">{</span>
      <span class="token variable">$header</span><span class="token punctuation">[</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token string single-quoted-string">'user-agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0;'</span><span class="token punctuation">;</span>
      <span class="token variable">$curl</span> <span class="token operator">=</span> <span class="token function">curl_init</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">#  初始化一个curl会话</span>
      <span class="token function">curl_setopt</span><span class="token punctuation">(</span><span class="token variable">$curl</span><span class="token punctuation">,</span> <span class="token constant">CURLOPT_URL</span><span class="token punctuation">,</span> <span class="token variable">$url</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment"># 想用PHP取回的url地址</span>
      <span class="token function">curl_setopt</span><span class="token punctuation">(</span><span class="token variable">$curl</span><span class="token punctuation">,</span> <span class="token constant">CURLOPT_RETURNTRANSFER</span><span class="token punctuation">,</span> <span class="token constant boolean">True</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment"># 设定是否显示头信息</span>
      <span class="token function">curl_setopt</span><span class="token punctuation">(</span><span class="token variable">$curl</span><span class="token punctuation">,</span> <span class="token constant">CURLOPT_FOLLOWLOCATION</span><span class="token punctuation">,</span> <span class="token constant boolean">True</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment"># 是否会跟踪爬取重定向页面</span>
      <span class="token function">curl_setopt</span><span class="token punctuation">(</span><span class="token variable">$curl</span><span class="token punctuation">,</span> <span class="token constant">CURLOPT_SSL_VERIFYPEER</span><span class="token punctuation">,</span> <span class="token constant boolean">False</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment"># 不检测证书</span>
      <span class="token function">curl_setopt</span><span class="token punctuation">(</span><span class="token variable">$curl</span><span class="token punctuation">,</span> <span class="token constant">CURLOPT_SSL_VERIFYHOST</span><span class="token punctuation">,</span> <span class="token constant boolean">False</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment"># 不检测证书</span>
      <span class="token function">curl_setopt</span><span class="token punctuation">(</span><span class="token variable">$curl</span><span class="token punctuation">,</span> <span class="token constant">CURLOPT_HEADER</span><span class="token punctuation">,</span> <span class="token constant boolean">False</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment"># 是否返回请求头信息</span>
      <span class="token function">curl_setopt</span><span class="token punctuation">(</span><span class="token variable">$curl</span><span class="token punctuation">,</span> <span class="token constant">CURLOPT_HTTPHEADER</span><span class="token punctuation">,</span> <span class="token variable">$header</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment"># 设置header头内容</span>
      <span class="token function">curl_setopt</span><span class="token punctuation">(</span><span class="token variable">$curl</span><span class="token punctuation">,</span> <span class="token constant">CURLOPT_ENCODING</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'gzip'</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment"># 解释gzip内容</span>
      <span class="token comment"># 判断请求类型</span>
      <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token variable">$method</span> <span class="token operator">!=</span> <span class="token string single-quoted-string">'GET'</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
          <span class="token comment"># CURLOPT_POST: 发送一个常规的POST请求，类型为：application/x-www-form-urlencoded，类似提交表单。</span>
          <span class="token function">curl_setopt</span><span class="token punctuation">(</span><span class="token variable">$curl</span><span class="token punctuation">,</span> <span class="token constant">CURLOPT_POST</span><span class="token punctuation">,</span> <span class="token constant boolean">True</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
          <span class="token function">curl_setopt</span><span class="token punctuation">(</span><span class="token variable">$curl</span><span class="token punctuation">,</span> <span class="token constant">CURLOPT_POSTFIELDS</span><span class="token punctuation">,</span> <span class="token function">http_build_query</span><span class="token punctuation">(</span><span class="token variable">$params</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token punctuation">}</span>
      <span class="token variable">$data</span> <span class="token operator">=</span> <span class="token function">curl_exec</span><span class="token punctuation">(</span><span class="token variable">$curl</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment"># 执行一个curl会话</span>
      <span class="token function">curl_close</span><span class="token punctuation">(</span><span class="token variable">$curl</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment"># 关闭curl会话</span>
      <span class="token keyword">return</span> <span class="token function">json_decode</span><span class="token punctuation">(</span><span class="token variable">$data</span><span class="token punctuation">,</span> <span class="token constant boolean">True</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br></div></div><h2 id="json-encode函数"><a href="#json-encode函数" class="header-anchor">#</a> json_encode函数</h2> <blockquote><p>php格式json的函数, 经常在加密的时候会遇到, 出现中文或者反斜杠转移的问题, 导致加密出来的结果不一致。</p></blockquote> <p><span style="color:blue;font-weight:bold;">语法格式</span></p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>json_encode<span class="token punctuation">(</span><span class="token variable">$value</span>,<span class="token variable">$options</span><span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><span style="color:blue;font-weight:bold;">其中有2个比较常用到的参数</span></p> <p><code>JSON_UNESCAPED_UNICODE</code> (中文不转为<code>unicode</code>，对应的数字 256)</p> <p><code>JSON_UNESCAPED_SLASHES</code> （不转义斜杠，对应的数字 64）</p> <p><span style="color:blue;font-weight:bold;">通常json_encode只能传入一个常量，如果同时使用2个常量怎么办？</span></p> <p><code>JSON_UNESCAPED_UNICODE</code> + <code>JSON_UNESCAPED_SLASHES</code> = 320</p> <p>使用方法:<code>json_encode($arr,320)</code> ; 即可完成同时使用2个常量</p> <h2 id="数组数据存入文件"><a href="#数组数据存入文件" class="header-anchor">#</a> 数组数据存入文件</h2> <p>一般多用于配置文件, 进行写入和读取操作</p> <h3 id="var-export函数实现"><a href="#var-export函数实现" class="header-anchor">#</a> <code>var_export</code>函数实现</h3> <p>效果:</p> <img src="/share/php/01.png" alt="foo"> <p>实现代码:</p> <div class="language-php line-numbers-mode"><pre class="language-php"><code><span class="token php language-php"><span class="token delimiter important">&lt;?php</span>
<span class="token variable">$data</span> <span class="token operator">=</span> <span class="token punctuation">[</span>
    <span class="token string single-quoted-string">'id'</span><span class="token operator">=&gt;</span><span class="token number">1</span><span class="token punctuation">,</span>
    <span class="token string single-quoted-string">'name'</span><span class="token operator">=&gt;</span><span class="token string double-quoted-string">&quot;二傻&quot;</span><span class="token punctuation">,</span>
    <span class="token string single-quoted-string">'info'</span><span class="token operator">=&gt;</span><span class="token punctuation">[</span>
        <span class="token string single-quoted-string">'sex'</span><span class="token operator">=&gt;</span><span class="token string double-quoted-string">&quot;性别男&quot;</span><span class="token punctuation">,</span>
        <span class="token string single-quoted-string">'hobby'</span><span class="token operator">=&gt;</span><span class="token string double-quoted-string">&quot;漂亮的妹子&quot;</span>
    <span class="token punctuation">]</span>
<span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token variable">$file</span> <span class="token operator">=</span> <span class="token string double-quoted-string">&quot;./config.php&quot;</span><span class="token punctuation">;</span>
<span class="token variable">$obj</span> <span class="token operator">=</span> <span class="token function">array_config</span><span class="token punctuation">(</span><span class="token variable">$data</span><span class="token punctuation">,</span><span class="token variable">$file</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">var_dump</span><span class="token punctuation">(</span><span class="token variable">$obj</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">/**
 * 数组写进配置文件,主要利用var_export函数
 * @param $data array 数组
 * @param $file string 配置文件路径和名称, 文件不存在会自动创建, 注意文件所在目录权限
 * @return false|int
 */</span>
<span class="token keyword">function</span> <span class="token function-definition function">array_config</span><span class="token punctuation">(</span><span class="token variable">$data</span><span class="token punctuation">,</span><span class="token variable">$file</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token variable">$content</span> <span class="token operator">=</span> <span class="token string double-quoted-string">&quot;&lt;?php\n return &quot;</span> <span class="token operator">.</span> <span class="token function">var_export</span><span class="token punctuation">(</span><span class="token variable">$data</span><span class="token punctuation">,</span> <span class="token constant boolean">true</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token string double-quoted-string">&quot;;&quot;</span><span class="token punctuation">;</span>
    <span class="token keyword">return</span>  <span class="token function">file_put_contents</span><span class="token punctuation">(</span><span class="token variable">$file</span><span class="token punctuation">,</span> <span class="token variable">$content</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</span></code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br></div></div><p>读取配置文件:</p> <div class="language-php line-numbers-mode"><pre class="language-php"><code><span class="token php language-php"><span class="token delimiter important">&lt;?php</span>
<span class="token variable">$file</span> <span class="token operator">=</span> <span class="token string double-quoted-string">&quot;./config.php&quot;</span><span class="token punctuation">;</span>
<span class="token variable">$obj</span> <span class="token operator">=</span> <span class="token keyword">require</span><span class="token punctuation">(</span><span class="token variable">$file</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">var_dump</span><span class="token punctuation">(</span><span class="token variable">$obj</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</span></code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><h3 id="序列化实现"><a href="#序列化实现" class="header-anchor">#</a> 序列化实现</h3> <p>效果:</p> <img src="/share/php/02.png" alt="foo"> <p>写入:</p> <div class="language-php line-numbers-mode"><pre class="language-php"><code><span class="token php language-php"><span class="token delimiter important">&lt;?php</span>
<span class="token variable">$data</span> <span class="token operator">=</span> <span class="token punctuation">[</span>
    <span class="token string single-quoted-string">'id'</span><span class="token operator">=&gt;</span><span class="token number">2</span><span class="token punctuation">,</span>
    <span class="token string double-quoted-string">&quot;name&quot;</span><span class="token operator">=&gt;</span><span class="token string double-quoted-string">&quot;翠花&quot;</span><span class="token punctuation">,</span>
    <span class="token string double-quoted-string">&quot;info&quot;</span><span class="token operator">=&gt;</span><span class="token punctuation">[</span>
        <span class="token string double-quoted-string">&quot;sex&quot;</span><span class="token operator">=&gt;</span><span class="token string double-quoted-string">&quot;性别男&quot;</span>
    <span class="token punctuation">]</span>
<span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token variable">$file</span> <span class="token operator">=</span> <span class="token string single-quoted-string">'./test.php'</span><span class="token punctuation">;</span>
<span class="token variable">$bool</span> <span class="token operator">=</span> <span class="token function">file_put_contents</span><span class="token punctuation">(</span><span class="token variable">$file</span><span class="token punctuation">,</span><span class="token function">serialize</span><span class="token punctuation">(</span><span class="token variable">$data</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">var_dump</span><span class="token punctuation">(</span><span class="token variable">$bool</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</span></code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br></div></div><p>读取:</p> <div class="language-php line-numbers-mode"><pre class="language-php"><code><span class="token php language-php"><span class="token delimiter important">&lt;?php</span>
<span class="token variable">$file</span> <span class="token operator">=</span> <span class="token string single-quoted-string">'./test.php'</span><span class="token punctuation">;</span>
<span class="token variable">$handle</span><span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token variable">$file</span><span class="token punctuation">,</span><span class="token string single-quoted-string">'r'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token variable">$data</span><span class="token operator">=</span><span class="token function">unserialize</span><span class="token punctuation">(</span><span class="token function">fread</span><span class="token punctuation">(</span><span class="token variable">$handle</span><span class="token punctuation">,</span><span class="token function">filesize</span><span class="token punctuation">(</span><span class="token variable">$file</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">fclose</span><span class="token punctuation">(</span><span class="token variable">$handle</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">var_dump</span><span class="token punctuation">(</span><span class="token variable">$data</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</span></code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><h2 id="递归创建文件夹"><a href="#递归创建文件夹" class="header-anchor">#</a> 递归创建文件夹</h2> <div class="language-php line-numbers-mode"><pre class="language-php"><code><span class="token php language-php"><span class="token delimiter important">&lt;?php</span>
<span class="token variable">$dir</span> <span class="token operator">=</span> <span class="token string double-quoted-string">&quot;./nice/test/day/&quot;</span><span class="token punctuation">;</span>
<span class="token keyword">echo</span> <span class="token function">mk_dir</span><span class="token punctuation">(</span><span class="token variable">$dir</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">die</span><span class="token punctuation">;</span>
<span class="token comment">/***
 * 递归创建文件夹
 * 注意: 创建文件夹的父级目录需要有执行权限
 * @param $path string 目录路径, 比如 ./nice/test/day/
 * @return bool
 */</span>
<span class="token keyword">function</span> <span class="token function-definition function">mk_dir</span><span class="token punctuation">(</span><span class="token variable">$path</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token function">is_dir</span><span class="token punctuation">(</span><span class="token variable">$path</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">return</span> <span class="token constant boolean">true</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">return</span> <span class="token punctuation">(</span>
            <span class="token function">is_dir</span><span class="token punctuation">(</span><span class="token function">dirname</span><span class="token punctuation">(</span><span class="token variable">$path</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">||</span> <span class="token class-name">mk_dir</span><span class="token punctuation">(</span><span class="token function">dirname</span><span class="token punctuation">(</span><span class="token variable">$path</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
        <span class="token punctuation">)</span>
        <span class="token operator">&amp;&amp;</span> <span class="token function">mkdir</span><span class="token punctuation">(</span><span class="token variable">$path</span><span class="token punctuation">,</span> <span class="token number">0777</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</span></code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br></div></div><h2 id="目录路径斜杠"><a href="#目录路径斜杠" class="header-anchor">#</a> 目录路径斜杠(/)</h2> <div class="custom-block danger"><p class="title">注意</p><p>windows下,目录之间斜杠是<code>\</code>, 而在linux上市<code>/</code>, 很多没时候没有注意, 找不到对应的路径资源;</p> <p>用PHP 预定义常量DIRECTORY_SEPARATOR来代替''，'/'这样的路径分隔符</p></div><div class="language-php line-numbers-mode"><pre class="language-php"><code><span class="token keyword">echo</span> <span class="token string double-quoted-string">&quot;test&quot;</span><span class="token operator">.</span><span class="token constant">DIRECTORY_SEPARATOR</span><span class="token operator">.</span><span class="token string double-quoted-string">&quot;logs&quot;</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>输出:</p> <div class="language-text line-numbers-mode"><pre class="language-text"><code>test\logs
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h2 id="时间函数"><a href="#时间函数" class="header-anchor">#</a> 时间函数</h2> <h3 id="date-函数"><a href="#date-函数" class="header-anchor">#</a> date()函数</h3> <p>用于格式化时间/日期。可把时间戳格式化为可读性更好的日期和时间。</p> <p><font color="blue"><strong>语法</strong></font></p> <div class="language-sh line-numbers-mode"><pre class="language-sh"><code>string <span class="token function">date</span> <span class="token punctuation">(</span> string <span class="token variable">$format</span> <span class="token punctuation">[</span>, int <span class="token variable">$timestamp</span> <span class="token punctuation">]</span> <span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><table><thead><tr><th>参数</th> <th>描述</th></tr></thead> <tbody><tr><td>format</td> <td>必须, 规定时间戳的格式</td></tr> <tr><td>timestamp</td> <td>可选, 规定时间戳, 默认是当前的日期和时间</td></tr></tbody></table> <div class="language-php line-numbers-mode"><pre class="language-php"><code><span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d H:i:s&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//输出:  2021-10-26 14:32:19</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><font color="blue"><strong>参数 format 的常用可用字符:</strong></font></p> <ol><li><code>d</code> - 代表月中的天 (01 - 31)</li> <li><code>m</code> - 代表月 (01 - 12)</li> <li><code>Y</code> - 代表年 (四位数)</li> <li><code>H</code> - 小时，24 小时格式，有前导零, 00 到 23</li> <li><code>i</code> - 分钟数, 有前导零, 	00 到 59</li> <li><code>s</code> - 秒数，有前导零, 00 到 59</li></ol> <h3 id="strtotime-函数"><a href="#strtotime-函数" class="header-anchor">#</a> strtotime()函数</h3> <p>将任何字符串的日期时间描述解析为 Unix 时间戳（自 January 1 1970 00:00:00 GMT 起的秒数）。</p> <p><font color="blue"><strong>语法</strong></font></p> <div class="language-sh line-numbers-mode"><pre class="language-sh"><code>int strtotime <span class="token punctuation">(</span> string <span class="token variable">$time</span> <span class="token punctuation">[</span>, int <span class="token variable">$now</span> <span class="token operator">=</span> time<span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">]</span> <span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><table><thead><tr><th>参数</th> <th>描述</th></tr></thead> <tbody><tr><td>time</td> <td>必须, 规定日期/时间字符串</td></tr> <tr><td>now</td> <td>可选, 规定用来计算返回值的时间戳, 如果省略该参数, 则使用当前时间戳</td></tr></tbody></table> <p><font color="blue"><strong>返回值:</strong></font> 成功则返回时间戳，失败则返回 FALSE。</p> <div class="language-php line-numbers-mode"><pre class="language-php"><code><span class="token keyword">echo</span> <span class="token string double-quoted-string">&quot;今天:&quot;</span><span class="token operator">.</span><span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d&quot;</span><span class="token punctuation">)</span><span class="token operator">.</span><span class="token string double-quoted-string">&quot;&lt;br&gt;&quot;</span><span class="token punctuation">;</span> <span class="token comment">//今天:2021-10-28</span>
<span class="token keyword">echo</span> <span class="token string double-quoted-string">&quot;昨天:&quot;</span><span class="token operator">.</span><span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d&quot;</span><span class="token punctuation">,</span><span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;-1 day&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token string double-quoted-string">&quot;&lt;br&gt;&quot;</span><span class="token punctuation">;</span> <span class="token comment">//昨天:2021-10-27</span>
<span class="token keyword">echo</span> <span class="token string double-quoted-string">&quot;明天:&quot;</span><span class="token operator">.</span><span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d&quot;</span><span class="token punctuation">,</span><span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;+1 day&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token operator">.</span> <span class="token string double-quoted-string">&quot;&lt;br&gt;&quot;</span><span class="token punctuation">;</span> <span class="token comment">//明天:2021-10-29</span>
<span class="token keyword">echo</span> <span class="token string double-quoted-string">&quot;去年:&quot;</span><span class="token operator">.</span><span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d&quot;</span><span class="token punctuation">,</span><span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;-1 year&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">//去年:2020-12-22</span>
<span class="token comment">// 输出当天0点时间</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d 00:00:00&quot;</span><span class="token punctuation">,</span> <span class="token function">time</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
<span class="token comment">// 输出当天最后一秒时间</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d 23:59:59&quot;</span><span class="token punctuation">,</span> <span class="token function">time</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
<span class="token comment">// 输出: 2021-10-26 15:26:36</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d H:i:s&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;now&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
<span class="token comment">// 输出: 2021-10-26 20:26:36</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d H:i:s&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;+5 hours&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
<span class="token comment">// 输出: 2021-09-21 15:26:36</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d H:i:s&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;-5 week&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
<span class="token comment">// 输出: 2021-11-05 22:26:41</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d H:i:s&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;+1 week 3days 7 hours 5 seconds&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
<span class="token comment">// 输出: 2021-11-01 00:00:00</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d H:i:s&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;next Monday&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
<span class="token comment">// 输出: 2021-10-24 00:00:00</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d H:i:s&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;last Sunday&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
<span class="token comment">// 输出: 2021-09-26 00:00:00</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d H:i:s&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;-1 month&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;2021-10-26&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
<span class="token comment">// 输出 2021-11-26 00:00:00</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d H:i:s&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;+1 month&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;2021-10-26&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
<span class="token comment">// 输出: 2021-10-26 00:00:00</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d H:i:s&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;next month&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;2021-09-26&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
<span class="token comment">// 输出: 2021-08-26 00:00:00</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d H:i:s&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;last month&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;2021-09-26&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
<span class="token comment">// 输出: 2021-08-31 00:00:00</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d H:i:s&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;last day of -1 month&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;2021-09-26&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
<span class="token comment">// 输出: 2021-10-01 00:00:00</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d H:i:s&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;first day of +1 month&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;2021-09-26&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
<span class="token comment">// 输出: 2021-10-01 00:00:00</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d H:i:s&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;first day of next month&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;2021-09-26&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
<span class="token comment">// 输出 2021-08-31 00:00:00</span>
<span class="token keyword">echo</span> <span class="token function">date</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;Y-m-d H:i:s&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;last day of last month&quot;</span><span class="token punctuation">,</span> <span class="token function">strtotime</span><span class="token punctuation">(</span><span class="token string double-quoted-string">&quot;2021-09-26&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token constant">PHP_EOL</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br></div></div><p>从PHP5.3开始呢, date新增了一系列修正短语, 来明确这个问题, 那就是&quot;first day of&quot; 和 &quot;last day of&quot;, 也就是你可以限定好不要让date自动&quot;规范化&quot;。</p> <h3 id="获取当前毫秒时间戳"><a href="#获取当前毫秒时间戳" class="header-anchor">#</a> 获取当前毫秒时间戳</h3> <div class="language-php line-numbers-mode"><pre class="language-php"><code><span class="token comment">// 获取当前毫秒时间戳</span>
<span class="token keyword">list</span><span class="token punctuation">(</span><span class="token variable">$mSec</span><span class="token punctuation">,</span> <span class="token variable">$sec</span><span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token function">explode</span><span class="token punctuation">(</span><span class="token string single-quoted-string">' '</span><span class="token punctuation">,</span> <span class="token function">microtime</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token variable">$millisecond</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token keyword type-casting">float</span><span class="token punctuation">)</span><span class="token function">sprintf</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'%.0f'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token function">floatval</span><span class="token punctuation">(</span><span class="token variable">$mSec</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token function">floatval</span><span class="token punctuation">(</span><span class="token variable">$sec</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">*</span> <span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">echo</span> <span class="token variable">$millisecond</span><span class="token punctuation">;</span> <span class="token comment">// 1635238562054</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><h2 id="异常处理"><a href="#异常处理" class="header-anchor">#</a> 异常处理</h2> <div class="language-php line-numbers-mode"><pre class="language-php"><code><span class="token keyword">try</span>
<span class="token punctuation">{</span>
  <span class="token variable">$a</span> <span class="token operator">=</span> <span class="token number">3</span><span class="token punctuation">;</span>
  <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token variable">$a</span> <span class="token operator">&gt;</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token comment"># 当变量a大于0的时候, 抛出异常</span>
    <span class="token keyword">throw</span> <span class="token keyword">new</span> <span class="token class-name class-name-fully-qualified"><span class="token punctuation">\</span>Exception</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'变量a不能大于0'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span> <span class="token keyword">catch</span> <span class="token punctuation">(</span><span class="token class-name class-name-fully-qualified"><span class="token punctuation">\</span>Exception</span> <span class="token variable">$e</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token function">var_dump</span><span class="token punctuation">(</span><span class="token variable">$e</span><span class="token operator">-&gt;</span><span class="token function">getMessage</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br></div></div><h2 id="判断一个不确定存在的变量"><a href="#判断一个不确定存在的变量" class="header-anchor">#</a> 判断一个不确定存在的变量</h2> <div class="language-php line-numbers-mode"><pre class="language-php"><code><span class="token keyword">public</span> <span class="token keyword">function</span> <span class="token function-definition function">test</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token keyword">isset</span><span class="token punctuation">(</span><span class="token variable">$payload</span><span class="token punctuation">[</span><span class="token string single-quoted-string">'iat'</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token operator">&amp;&amp;</span> <span class="token variable">$payload</span><span class="token punctuation">[</span><span class="token string single-quoted-string">'iat'</span><span class="token punctuation">]</span> <span class="token operator">!==</span> <span class="token string single-quoted-string">''</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token keyword">echo</span> <span class="token number">123</span><span class="token punctuation">;</span><span class="token keyword">die</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">echo</span> <span class="token number">88</span><span class="token punctuation">;</span><span class="token keyword">die</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div></div></section> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">Last Updated: </span> <span class="time">2022/6/9 10:12:21</span></div></footer> <div class="page-nav"><p class="inner"><!----> <span class="next"><a href="/share/docs/php/composer.html">
            composer包制作
          </a></span></p></div> <div class="comments-wrapper"><!----></div> <ul class="side-bar sub-sidebar-wrapper" style="width:12rem;" data-v-cb1513f6><li class="level-2" data-v-cb1513f6><a href="/share/docs/php/#windows-phpstudy-下php-8-0-12-安装mcrypt扩展问题" class="sidebar-link reco-side-windows-phpstudy-下php-8-0-12-安装mcrypt扩展问题" data-v-cb1513f6>Windows(phpStudy)下php(8.0.12)安装mcrypt扩展问题</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/php/#代码修改后延时生效问题" class="sidebar-link reco-side-代码修改后延时生效问题" data-v-cb1513f6>代码修改后延时生效问题</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/php/#curl抓取" class="sidebar-link reco-side-curl抓取" data-v-cb1513f6>CURL抓取</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/php/#json-encode函数" class="sidebar-link reco-side-json-encode函数" data-v-cb1513f6>json_encode函数</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/php/#数组数据存入文件" class="sidebar-link reco-side-数组数据存入文件" data-v-cb1513f6>数组数据存入文件</a></li><li class="level-3" data-v-cb1513f6><a href="/share/docs/php/#var-export函数实现" class="sidebar-link reco-side-var-export函数实现" data-v-cb1513f6>var_export函数实现</a></li><li class="level-3" data-v-cb1513f6><a href="/share/docs/php/#序列化实现" class="sidebar-link reco-side-序列化实现" data-v-cb1513f6>序列化实现</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/php/#递归创建文件夹" class="sidebar-link reco-side-递归创建文件夹" data-v-cb1513f6>递归创建文件夹</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/php/#目录路径斜杠" class="sidebar-link reco-side-目录路径斜杠" data-v-cb1513f6>目录路径斜杠(/)</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/php/#时间函数" class="sidebar-link reco-side-时间函数" data-v-cb1513f6>时间函数</a></li><li class="level-3" data-v-cb1513f6><a href="/share/docs/php/#date-函数" class="sidebar-link reco-side-date-函数" data-v-cb1513f6>date()函数</a></li><li class="level-3" data-v-cb1513f6><a href="/share/docs/php/#strtotime-函数" class="sidebar-link reco-side-strtotime-函数" data-v-cb1513f6>strtotime()函数</a></li><li class="level-3" data-v-cb1513f6><a href="/share/docs/php/#获取当前毫秒时间戳" class="sidebar-link reco-side-获取当前毫秒时间戳" data-v-cb1513f6>获取当前毫秒时间戳</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/php/#异常处理" class="sidebar-link reco-side-异常处理" data-v-cb1513f6>异常处理</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/php/#判断一个不确定存在的变量" class="sidebar-link reco-side-判断一个不确定存在的变量" data-v-cb1513f6>判断一个不确定存在的变量</a></li></ul></main> <!----></div></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;display:none;" data-v-c6073ba8 data-v-c6073ba8><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-c6073ba8><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-c6073ba8></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-c6073ba8></path></svg></div><!----><div class="kanbanniang" data-v-5775ee02><div class="banniang-container" style="display:;" data-v-5775ee02><div class="messageBox" style="left:68px;bottom:370px;display:none;" data-v-5775ee02>
      欢迎来到我的博客
    </div> <div class="operation" style="right:90px;bottom:40px;display:none;" data-v-5775ee02><i class="kbnfont kbn-ban-home ban-home" data-v-5775ee02></i> <i class="kbnfont kbn-ban-message message" data-v-5775ee02></i> <i class="kbnfont kbn-ban-close close" data-v-5775ee02></i> <a target="_blank" href="https://vuepress-theme-reco.recoluan.com/views/plugins/kanbanniang.html" data-v-5775ee02><i class="kbnfont kbn-ban-info info" data-v-5775ee02></i></a> <i class="kbnfont kbn-ban-theme skin" style="display:;" data-v-5775ee02></i></div> <canvas id="banniang" width="260px" height="420" class="live2d" style="right:200px;bottom:20px;opacity:0.4;" data-v-5775ee02></canvas></div> <div class="showBanNiang" style="display:none;" data-v-5775ee02>
    看板娘
  </div></div><canvas id="vuepress-canvas-cursor"></canvas><!----><div class="RibbonAnimation"></div><!----></div></div>
    <script src="/share/assets/js/app.706684de.js" defer></script><script src="/share/assets/js/3.4685d505.js" defer></script><script src="/share/assets/js/1.b12738fb.js" defer></script><script src="/share/assets/js/59.5239e9d4.js" defer></script><script src="/share/assets/js/9.4e81f08e.js" defer></script>
  </body>
</html>
